package com.rxb.blog.common;

import com.rxb.blog.utils.SessionException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * Author：rxb
 * Date：2020-02-29 20:38
 * Description：全局异常捕获
 */
@ControllerAdvice
public class BlogAdvice {

    @ExceptionHandler(value = SessionException.class)
    public CommonResult<String> exceptionHandler(Exception e){
        System.out.println("未知异常！原因是:"+e);
        return CommonResult.failed(e.getMessage());
    }

}
